﻿<DemoContainer>

     <Button class="mb-2" OnClick=ToggleDataPoint BackgroundColor="TablerColor.Primary">Toggle Data Point</Button>


    <ApexChart TItem="Order"
               Title="Order Gross Value"
     @ref=chart>

        <ApexPointSeries TItem="Order"
                         Items="orders"
                         Name="Gross Value"
                         SeriesType="SeriesType.Pie"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.GrossValue))"
                         OrderByDescending="e=>e.X" />
    </ApexChart>
</DemoContainer>


@code {
    private List<Order> orders { get; set; } = SampleData.GetOrders();
    private ApexChart<Order> chart;
  
    private async Task ToggleDataPoint()
    {

        await chart.ToggleDataPointSelectionAsync(0, null);
    }
    }